package yc.day0109.travelt.dao.impl;



import yc.day0109.lottery.utils.BaseDao;
import yc.day0109.travelt.dao.ScenicSpotDao;
import yc.day0109.travelt.po.ScenicSpot;

import java.sql.SQLException;
import java.util.ArrayList;

import java.util.List;
import java.util.Map;

public class ScenicSpotDaoImpl extends BaseDao implements ScenicSpotDao {
    @Override
    public List<ScenicSpot> queryScenicSpot(Map<String, Object> params) {
        List<ScenicSpot> scenicSpotList = new ArrayList<>();
        ScenicSpot scenicSpot = null;
        String sql = "select ss_name,ss_duration,ss_content from scenic_spot";
        super.rs = super.executeQuery(sql);
        try {
            while(rs.next()){
                scenicSpot = new ScenicSpot();
                scenicSpot.setSsName(rs.getString("ss_name"));
                scenicSpot.setSsDuration(rs.getString("ss_duration"));
                scenicSpot.setSsContent(rs.getString("ss_content"));
                scenicSpotList.add(scenicSpot);
            }
        }catch (SQLException e){
            e.printStackTrace();
        }finally {
            closeAll(rs,pstmt,conn);
        }
        return scenicSpotList;
    }
}
